<style>
    .link-update{
        text-decoration: none;
        background: #337ab7;
        color: white;
        padding: 5px 10px;
        border-radius: 4px;
        margin-bottom: 10px;
        display: inline-block;
    }
    .link-update:hover{
        text-decoration: none;
        color: white;
        background: #286090;
    }
    .link-del{
        text-decoration: none;
        background: red;
        color: white;
        padding: 5px 10px;
        border-radius: 4px;
        margin-bottom: 10px;
        display: inline-block;
    }
    .link-del:hover{
        text-decoration: none;
        background: red;
        color: white;
    }
    .addBtn{
        text-decoration: none;
        background: #337ab7;
        color: white;
        padding: 5px 10px;
        border-radius: 4px;
        margin-bottom:10px;
        display: inline-block;
    }
    .info-wrap>td {
        text-align: center;
        padding-top: 10px;
    }
    .info-wrap>td>div {
        max-height: 200px;
        overflow-y: auto;
    }
    .info-wrap{
        border-bottom: 1px solid #cccccc;
    }
</style>
<div class="span10">
    <div style="margin-bottom: 20px">
        <a>首页</a>
        <span >&gt;</span>
        <span>讲师管理</span>
    </div>
    <a class="addBtn" href="<?php echo baseUrl.'/content/teachers/add'?>">添加老师</a>
    <form action="<?php echo baseUrl?>/content/teachers/index" method="get" class="form-horizontal">

        <table class="table">
            <tr>
                <td>
                    老师姓名：
                </td>
                <td>
                    <input name="name" value="<?php echo isset($_GET['name'])?$_GET['name']:''?>"/>
                </td>
                <td>
                    <button class="btn btn-primary" type="submit">提交</button>
                </td>
            </tr>
        </table>
    </form>

    <form action="/content/api/sort" method="post">
        <table border="0" allrules="0" width="100%" id="infoTable">
            <tr align="center">
                <th width="60px">排序</th>
                <th>id</th>
                <th>老师</th>
                <th>图片</th>
                <th>简介</th>
                <th>课程</th>
                <th>职位</th>
                <th width="120px">操作</th>
            </tr>
            <?php
            foreach ($data as $v) {
                ?>
                <tr class="info-wrap">
                    <td>
                        <input style="width: 20px;" name="sort[]" type="text" value="<?php echo $v['sort'] ?>">
                        <input name="id[]" type="hidden" value="<?php echo $v['id'] ?>">
                    </td>
                    <td>
                        <?php echo $v['id'] ?>
                    </td>
                    <td><?php echo $v['name'] ?></td>
                    <td><?php echo $v['pic'] ?></td>
                    <td><?php echo $v['smallIntro'] ?></td>
                    <td><?php echo $v['subject'] ?></td>
                    <td><?php echo $v['seniority'] ?></td>
                    <td>
                        <a class="link-update"
                           href="<?php echo baseUrl . '/content/teachers/add' . '?' . 'id=' . $v['id'] ?>">修改</a>
                        <a class="link-del" href="" onclick="del(<?php echo $v['id'] ?>)">删除</a>
                    </td>
                </tr>
            <?php } ?>
        </table>
        <input type="hidden" name="cate" value="1">
        <button class="push btn btn-primary" type="submit">排序</button>
    </form>
</div>
<script>
        function del(id){
            if(confirm("确定删除内容吗")) {
                $.get("/content/teachers/del", {id: id},
                    function (msg) {
                        if (msg) {
                            alert('删除成功');
                        }
                    }, 'text'
                );
            }
        }
</script>
